package com.mtsmda.demo.spring.spring_core.run;

import org.springframework.context.ApplicationContext;
import org.springframework.context.annotation.AnnotationConfigApplicationContext;

import com.mtsmda.demo.spring.spring_core.javaConfig.AppConfig;
import com.mtsmda.demo.spring.spring_core.javaConfig.CustomerBo;
import com.mtsmda.demo.spring.spring_core.javaConfig.PersonBo;
import com.mtsmda.demo.spring.spring_core.looseCoupling.OutputFormatI;

public class RunSpringJavaConfig {

	public static void main(String[] args) {
		ApplicationContext context = new AnnotationConfigApplicationContext(
				AppConfig.class);
		j1(context);
		j2(context);
		j3(context);
	}

	private static void j3(ApplicationContext context) {
		PersonBo personBo = (PersonBo) context.getBean("person");
		personBo.printMessage(" Ion");
	}

	private static void j2(ApplicationContext context) {
		CustomerBo customerBo = (CustomerBo) context.getBean("customer");
		customerBo.printMessage(" Ion");
	}

	private static void j1(ApplicationContext context) {
		OutputFormatI xmlOutputFormatI = (OutputFormatI) context
				.getBean("jsonOF");
		xmlOutputFormatI.generateOutput();
	}

}